/*****************************************************************************
 * (C) Copyright 2015 Atech-Automotive
 * FILE NAME:    msg_canList.c
 * DESCRIPTION:
 * 
 * DATE BEGUN:   2015/06/03
 * BY:           martin.zhang
 * PRODUCT NAME:
 * APPLICATION:
 * TARGET H/W:
 * DOC REF:
 *****************************************************************************
 */
#include "msg_canList.h"
#include "app_can_Itf.h"
#include <string.h>
/* Variables */                
CAN_TX_MSG_S    
CanMsgNull_Tx = {
    TRUE,
    0x000, 
    8, 
    CAN_NORMAL, 
    CAN_EVENT, 
    FALSE, 
    CAN_PERIOD_100MS, 
    0, 
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
};

CAN_RX_MSG_S    
CanMsgNull_Rx = {
    TRUE, 
    0x000,
    8,
    CAN_NORMAL,
    CAN_EVENT,
    CAN_PERIOD_100MS,
    10*CAN_PERIOD_100MS,
    10*CAN_PERIOD_100MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

#define FOR_USER
/*******************************for user***************************************/

#define CAN_TX_CYCLE

CAN_TX_MSG_S    //AVM1
CanMsg520_Tx = {
    TRUE,
    0x520, 
    8, 
    CAN_NORMAL, 
    CAN_CYCLE, 
    FALSE, 
    CAN_PERIOD_1S, 
    0, 
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
};

CAN_TX_MSG_S    //AVM2
CanMsg51C_Tx = {
    TRUE,
    0x51C, 
    3, 
    CAN_NORMAL, 
    CAN_CYCLE, 
    FALSE, 
    CAN_PERIOD_500MS, 
    0, 
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
};

CAN_TX_MSG_S    //NWM_AVM
CanMsg606_Tx = {
    TRUE,
    0x606, 
    2, 
    CAN_NORMAL, 
    CAN_EVENT, 
    FALSE, 
    CAN_PERIOD_500MS, 
    0, 
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
};


//dy end
#define CAN_TX_EVENT


#define CAN_RX_CYCLE
/********************/
CAN_RX_MSG_S    
CanMsg774_Rx = {
    TRUE, 
    0x774,//0x7FA,
    8,
    CAN_DIAG,
    CAN_EVENT,
    CAN_PERIOD_10MS,
    0,
    30*CAN_PERIOD_10MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

CAN_RX_MSG_S 
CanMsg7DF_Rx = {//UDS
    TRUE, 
    0x7DF,
    8,
    CAN_DIAG,
    CAN_EVENT,
    CAN_PERIOD_10MS,
    0,
    10 * CAN_PERIOD_10MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};
	
CAN_RX_MSG_S    //BCM4
CanMsg392_Rx = {
    TRUE, 
    0x392,
    8,
    CAN_NORMAL,
    CAN_CYCLE,
    CAN_PERIOD_20MS,
    0,
    30*CAN_PERIOD_20MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

CAN_RX_MSG_S    //RRM_3
CanMsg517_Rx = {
    TRUE, 
    0x517,
    8,
    CAN_NORMAL,
    CAN_CYCLE,
    CAN_PERIOD_1S,
    0,
    30*CAN_PERIOD_1S,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

CAN_RX_MSG_S    //BCM_EMS_G
CanMsg280_Rx = {
    TRUE, 
    0x280,
    8,
    CAN_NORMAL,
    CAN_CYCLE,
    CAN_PERIOD_100MS,
    0,
    30*CAN_PERIOD_100MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

CAN_RX_MSG_S    //BCM_ABS/ESP_G
CanMsg2C0_Rx = {
    TRUE, 
    0x2C0,
    8,
    CAN_NORMAL,
    CAN_CYCLE,
    CAN_PERIOD_100MS,
    0,
    30*CAN_PERIOD_100MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

CAN_RX_MSG_S    //BCM_SAM_G
CanMsg340_Rx = {
    TRUE, 
    0x340,
    8,
    CAN_NORMAL,
    CAN_CYCLE,
    CAN_PERIOD_100MS,
    0,
    30*CAN_PERIOD_100MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

#if CAN_RX_USE_TEST
CAN_RX_MSG_S    //
CanMsg123_Rx = {
    TRUE, 
    0x123,
    8,
    CAN_NORMAL,
    CAN_EVENT,
    CAN_PERIOD_100MS,
    0,
    30*CAN_PERIOD_100MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

CAN_RX_MSG_S    //BCM_SAM_G
CanMsg124_Rx = {
    TRUE, 
    0x124,
    8,
    CAN_NORMAL,
    CAN_EVENT,
    CAN_PERIOD_100MS,
    0,
    30*CAN_PERIOD_100MS,
    POWER_30,
    FALSE,
    FALSE,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
    {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
};

#endif


/*Tx message table*/
CAN_TX_MSG_S *p_s_canCycTxTable[]=
{
	&CanMsg520_Tx,
    &CanMsg51C_Tx,
    &CanMsg606_Tx,
    &CanMsgNull_Tx
};

/*Rx message table*/
CAN_RX_MSG_S *p_s_canRxTable[] =
{
#if CAN_RX_USE_X70
    &CanMsg392_Rx,
    &CanMsg517_Rx,
    &CanMsg280_Rx,
    &CanMsg2C0_Rx,
    &CanMsg340_Rx,
#endif
#if CAN_RX_USE_TEST
	&CanMsg123_Rx,
	&CanMsg124_Rx,
#endif
    &CanMsg774_Rx,
    &CanMsg7DF_Rx,
    &CanMsgNull_Rx
};

CAN_RX_MSG_S *p_s_canFastRxTable[]=
{
    &CanMsgNull_Rx
};

const UINT8 p_s_canRxFilter[0x100] =
{
    0b00000000,  //0x0 - 0x7
    0b00000000,  //0x8 - 0xF
    0b00000000,  //0x10 - 0x17
    0b00000000,  //0x18 - 0x1F
    0b00000000,  //0x20 - 0x27
    0b00000000,  //0x28 - 0x2F
    0b00000000,  //0x30 - 0x37
    0b00000000,  //0x38 - 0x3F
    0b00000000,  //0x40 - 0x47
    0b00000000,  //0x48 - 0x4F
    0b00000000,  //0x50 - 0x57
    0b00000000,  //0x58 - 0x5F
    0b00000000,  //0x60 - 0x67
    0b00000000,  //0x68 - 0x6F
    0b00000000,  //0x70 - 0x77
    0b00000000,  //0x78 - 0x7F
    0b00000000,  //0x80 - 0x87
    0b00000000,  //0x88 - 0x8F
    0b00000000,  //0x90 - 0x97
    0b00000000,  //0x98 - 0x9F
    0b00000000,  //0xA0 - 0xA7
    0b00000000,  //0xA8 - 0xAF
    0b00000000,  //0xB0 - 0xB7
    0b00000000,  //0xB8 - 0xBF
    0b00000010,  //0xC0 - 0xC7
    0b00000000,  //0xC8 - 0xCF
    0b00000000,  //0xD0 - 0xD7
    0b00000000,  //0xD8 - 0xDF
    0b00000000,  //0xE0 - 0xE7
    0b00000000,  //0xE8 - 0xEF
    0b00000000,  //0xF0 - 0xF7
    0b00000000,  //0xF8 - 0xFF
    0b00000000,  //0x100 - 0x107
    0b00000000,  //0x108 - 0x10F
    0b00000000,  //0x110 - 0x117
    0b00000000,  //0x118 - 0x11F
    0b00001000,  //0x120 - 0x127
    0b00000000,  //0x128 - 0x12F
    0b00000000,  //0x130 - 0x137
    0b00000000,  //0x138 - 0x13F
    0b00000000,  //0x140 - 0x147
    0b00000000,  //0x148 - 0x14F
    0b00000000,  //0x150 - 0x157
    0b00000000,  //0x158 - 0x15F
    0b00000000,  //0x160 - 0x167
    0b00000000,  //0x168 - 0x16F
    0b00000000,  //0x170 - 0x177
    0b00000000,  //0x178 - 0x17F
    0b00000000,  //0x180 - 0x187
    0b00000000,  //0x188 - 0x18F
    0b00000000,  //0x190 - 0x197
    0b00000000,  //0x198 - 0x19F
    0b00000000,  //0x1A0 - 0x1A7
    0b00000000,  //0x1A8 - 0x1AF
    0b00000000,  //0x1B0 - 0x1B7
    0b00000000,  //0x1B8 - 0x1BF
    0b00000000,  //0x1C0 - 0x1C7
    0b00000000,  //0x1C8 - 0x1CF
    0b00000000,  //0x1D0 - 0x1D7
    0b00000000,  //0x1D8 - 0x1DF
    0b00000000,  //0x1E0 - 0x1E7
    0b00000000,  //0x1E8 - 0x1EF
    0b00000000,  //0x1F0 - 0x1F7
    0b00000000,  //0x1F8 - 0x1FF
    0b00000000,  //0x200 - 0x207
    0b00000000,  //0x208 - 0x20F
    0b00000000,  //0x210 - 0x217
    0b00000000,  //0x218 - 0x21F
    0b00000000,  //0x220 - 0x227
    0b00000000,  //0x228 - 0x22F
    0b00000000,  //0x230 - 0x237
    0b00000000,  //0x238 - 0x23F
    0b00000000,  //0x240 - 0x247
    0b00000000,  //0x248 - 0x24F
    0b00000000,  //0x250 - 0x257
    0b00000000,  //0x258 - 0x25F
    0b00000000,  //0x260 - 0x267
    0b00000000,  //0x268 - 0x26F
    0b00000000,  //0x270 - 0x277
    0b00000000,  //0x278 - 0x27F
    0b00000000,  //0x280 - 0x287
    0b00000000,  //0x288 - 0x28F
    0b00000000,  //0x290 - 0x297
    0b00000000,  //0x298 - 0x29F
    0b00000000,  //0x2A0 - 0x2A7
    0b00000000,  //0x2A8 - 0x2AF
    0b00000000,  //0x2B0 - 0x2B7
    0b00000000,  //0x2B8 - 0x2BF
    0b00000000,  //0x2C0 - 0x2C7
    0b00000000,  //0x2C8 - 0x2CF
    0b00000000,  //0x2D0 - 0x2D7
    0b00000000,  //0x2D8 - 0x2DF
    0b00000000,  //0x2E0 - 0x2E7
    0b00000000,  //0x2E8 - 0x2EF
    0b00000000,  //0x2F0 - 0x2F7
    0b00000000,  //0x2F8 - 0x2FF
    0b00000000,  //0x300 - 0x307
    0b00000000,  //0x308 - 0x30F
    0b00000000,  //0x310 - 0x317
    0b00000000,  //0x318 - 0x31F
    0b00000000,  //0x320 - 0x327
    0b00000000,  //0x328 - 0x32F
    0b00000000,  //0x330 - 0x337
    0b00000000,  //0x338 - 0x33F
    0b00000000,  //0x340 - 0x347
    0b00000000,  //0x348 - 0x34F
    0b00000000,  //0x350 - 0x357
    0b00000000,  //0x358 - 0x35F
    0b00000000,  //0x360 - 0x367
    0b00000000,  //0x368 - 0x36F
    0b00000000,  //0x370 - 0x377
    0b00000000,  //0x378 - 0x37F
    0b00000000,  //0x380 - 0x387
    0b00000000,  //0x388 - 0x38F
    0b00000110,  //0x390 - 0x397
    0b00000000,  //0x398 - 0x39F
    0b00000000,  //0x3A0 - 0x3A7
    0b00000000,  //0x3A8 - 0x3AF
    0b00000000,  //0x3B0 - 0x3B7
    0b00000000,  //0x3B8 - 0x3BF
    0b00000000,  //0x3C0 - 0x3C7
    0b00000000,  //0x3C8 - 0x3CF
    0b00000000,  //0x3D0 - 0x3D7
    0b00000000,  //0x3D8 - 0x3DF
    0b00000000,  //0x3E0 - 0x3E7
    0b00000000,  //0x3E8 - 0x3EF
    0b00000000,  //0x3F0 - 0x3F7
    0b00000000,  //0x3F8 - 0x3FF
    0b00000000,  //0x400 - 0x407
    0b00000000,  //0x408 - 0x40F
    0b00000000,  //0x410 - 0x417
    0b00000000,  //0x418 - 0x41F
    0b00000000,  //0x420 - 0x427
    0b00000000,  //0x428 - 0x42F
    0b00000000,  //0x430 - 0x437
    0b00000000,  //0x438 - 0x43F
    0b00010000,  //0x440 - 0x447
    0b00000000,  //0x448 - 0x44F
    0b00000000,  //0x450 - 0x457
    0b00000000,  //0x458 - 0x45F
    0b00000000,  //0x460 - 0x467
    0b00000000,  //0x468 - 0x46F
    0b00000000,  //0x470 - 0x477
    0b00000000,  //0x478 - 0x47F
    0b00000000,  //0x480 - 0x487
    0b00000000,  //0x488 - 0x48F
    0b00000000,  //0x490 - 0x497
    0b00000000,  //0x498 - 0x49F
    0b00000000,  //0x4A0 - 0x4A7
    0b00000000,  //0x4A8 - 0x4AF
    0b00000000,  //0x4B0 - 0x4B7
    0b00000000,  //0x4B8 - 0x4BF
    0b00000000,  //0x4C0 - 0x4C7
    0b00000000,  //0x4C8 - 0x4CF
    0b00000000,  //0x4D0 - 0x4D7
    0b00000000,  //0x4D8 - 0x4DF
    0b00000000,  //0x4E0 - 0x4E7
    0b00000000,  //0x4E8 - 0x4EF
    0b00000000,  //0x4F0 - 0x4F7
    0b00000000,  //0x4F8 - 0x4FF
    0b00000000,  //0x500 - 0x507
    0b00000000,  //0x508 - 0x50F
    0b00000000,  //0x510 - 0x517
    0b00000000,  //0x518 - 0x51F
    0b00000000,  //0x520 - 0x527
    0b00000000,  //0x528 - 0x52F
    0b00000000,  //0x530 - 0x537
    0b00000000,  //0x538 - 0x53F
    0b00000000,  //0x540 - 0x547
    0b00000000,  //0x548 - 0x54F
    0b00000000,  //0x550 - 0x557
    0b00000000,  //0x558 - 0x55F
    0b00100000,  //0x560 - 0x567
    0b00000000,  //0x568 - 0x56F
    0b00000000,  //0x570 - 0x577
    0b00000000,  //0x578 - 0x57F
    0b00000000,  //0x580 - 0x587
    0b00000000,  //0x588 - 0x58F
    0b00000000,  //0x590 - 0x597
    0b00000000,  //0x598 - 0x59F
    0b00000000,  //0x5A0 - 0x5A7
    0b00000000,  //0x5A8 - 0x5AF
    0b00000000,  //0x5B0 - 0x5B7
    0b00000000,  //0x5B8 - 0x5BF
    0b00000000,  //0x5C0 - 0x5C7
    0b00000000,  //0x5C8 - 0x5CF
    0b00000000,  //0x5D0 - 0x5D7
    0b00000000,  //0x5D8 - 0x5DF
    0b00000000,  //0x5E0 - 0x5E7
    0b00000000,  //0x5E8 - 0x5EF
    0b00000000,  //0x5F0 - 0x5F7
    0b00000000,  //0x5F8 - 0x5FF
    0b00000000,  //0x600 - 0x607
    0b00000000,  //0x608 - 0x60F
    0b00000000,  //0x610 - 0x617
    0b00000000,  //0x618 - 0x61F
    0b00000000,  //0x620 - 0x627
    0b00000000,  //0x628 - 0x62F
    0b00000000,  //0x630 - 0x637
    0b00000000,  //0x638 - 0x63F
    0b00000000,  //0x640 - 0x647
    0b00000000,  //0x648 - 0x64F
    0b00000000,  //0x650 - 0x657
    0b00000000,  //0x658 - 0x65F
    0b00000000,  //0x660 - 0x667
    0b00000000,  //0x668 - 0x66F
    0b00000000,  //0x670 - 0x677
    0b00000000,  //0x678 - 0x67F
    0b00000000,  //0x680 - 0x687
    0b00000000,  //0x688 - 0x68F
    0b00000000,  //0x690 - 0x697
    0b00000000,  //0x698 - 0x69F
    0b00000000,  //0x6A0 - 0x6A7
    0b00000000,  //0x6A8 - 0x6AF
    0b00000000,  //0x6B0 - 0x6B7
    0b00000000,  //0x6B8 - 0x6BF
    0b00000000,  //0x6C0 - 0x6C7
    0b00000000,  //0x6C8 - 0x6CF
    0b00000000,  //0x6D0 - 0x6D7
    0b00000000,  //0x6D8 - 0x6DF
    0b00000000,  //0x6E0 - 0x6E7
    0b00000000,  //0x6E8 - 0x6EF
    0b00000000,  //0x6F0 - 0x6F7
    0b00000000,  //0x6F8 - 0x6FF
    0b00000000,  //0x700 - 0x707
    0b00000000,  //0x708 - 0x70F
    0b00000000,  //0x710 - 0x717
    0b00000000,  //0x718 - 0x71F
    0b00000000,  //0x720 - 0x727
    0b00000000,  //0x728 - 0x72F
    0b00000000,  //0x730 - 0x737
    0b00000000,  //0x738 - 0x73F
    0b00000000,  //0x740 - 0x747
    0b00000000,  //0x748 - 0x74F
    0b00000000,  //0x750 - 0x757
    0b00000000,  //0x758 - 0x75F
    0b00000000,  //0x760 - 0x767
    0b00000000,  //0x768 - 0x76F
    0b00000000,  //0x770 - 0x777
    0b00000000,  //0x778 - 0x77F
    0b00000000,  //0x780 - 0x787
    0b00000000,  //0x788 - 0x78F
    0b00000000,  //0x790 - 0x797
    0b00000000,  //0x798 - 0x79F
    0b00000000,  //0x7A0 - 0x7A7
    0b00000000,  //0x7A8 - 0x7AF
    0b00000000,  //0x7B0 - 0x7B7
    0b00000000,  //0x7B8 - 0x7BF
    0b00000000,  //0x7C0 - 0x7C7
    0b00000000,  //0x7C8 - 0x7CF
    0b00000000,  //0x7D0 - 0x7D7
    0b00000000,  //0x7D8 - 0x7DF
    0b00000000,  //0x7E0 - 0x7E7
    0b00000000,  //0x7E8 - 0x7EF
    0b00000000,  //0x7F0 - 0x7F7
    0b10000000,  //0x7F8 - 0x7FF
};


